﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProjectChords.Services.Models;
using ProjectChords.Services.API;

namespace ProjectChords.Services.Impl.Memory
{
    public class StudentServiceInMemoryImpl : GenericInMemoryService<Student>, IStudentService
    {
        public StudentServiceInMemoryImpl()
            : base()
        {
        }

        public override string GetConstraintValue(Student obj)
        {
            return GetConstrainString(obj.School.Id, obj.Class);
        }

        public List<Student> GetAllStudentsOfAClass(string schoolId, string schoolClass)
        {
            return GetAllItemsForGivenConstraint(GetConstrainString(schoolId, schoolClass));
        }

        private static string GetConstrainString(string schoolId, string schoolClass)
        {
            return schoolId + "-" + schoolClass;
        }
    }
}
